package jcf;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapTest {
    public static void main(String[] args) {
        //校园用户 id=username
      Map<Integer,String> schoolMap=new HashMap<>();
      schoolMap.put(10,"雪雪");
      schoolMap.put(11,"停停");
      schoolMap.put(12,"牛牛");
      System.out.println(schoolMap.get(11));
      System.out.println( schoolMap.get(20));
      System.out.println(schoolMap.getOrDefault(23,"zs"));
        System.out.println(schoolMap.containsKey(10));
        System.out.println(schoolMap.containsValue("雪雪"));
        schoolMap.remove(12);
      System.out.println(schoolMap);
      System.out.println(schoolMap.isEmpty());
      //迭代 1. Map->Set
        Set<Map.Entry<Integer,String>> set=schoolMap.entrySet();
        for(Map.Entry<Integer,String> entry : set){
            System.out.print(entry.getKey());
            System.out.print("=");
            System.out.print(entry.getValue());
            System.out.println();
        }
    }
}
